<?php 
    $months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
    "Oct", "Nov", "Dec");
    ini_set("date.timezone", "Europe/Paris");
    for($i=0 ; $i<12; $i++){
        $dropdown_data[$i+1]=$months[$i];
    }
    for($i=0;$i<31;$i++){
        $day_data[$i+1]=$i+1;
    }
    for($i=2011;$i>1900;$i--){
        $year_data[$i]=$i;
    }
    if($query->num_rows()>0){
        $content_data = $query->row();
    } else{
        redirect('contenu');
    }                
    if(isset($error)) echo $error;
?>
<table class="titrepage" width="1000px">
    <tr>              
        <td><a class="titrea" href="<?php echo site_url('contenu')?>">La liste des Contenu</a></td>
        <td><a class="titrea" href="<?php echo site_url('contenu/add_content')?>">Post Content</a></td>
        <td align="right">Total | <?php echo $this->db->count_all('content');?></td>
    </tr>
</table>
<br/>
<div id="postContentWrapper">
    <div id="postContent">
        <form  method="post" action="<?php echo site_url('contenu/edit_content').'/'.$content_data->id_content;?>" enctype="multipart/form-data">
        <table>
            <tr>
                <td><label for="image">Image :</label></td>
                <td><img src="<?php echo base_url().'assets/thumbs/'.$content_data->image;?>" id="pass_away_img" width="90" height="60" alt="">
                <input type="file" name="userfile" size="33" />
                </td>
                
            </tr>
            <tr>
                <td><label for="firstname">First name : </label></td>
                <td><input type="text" name="firstnameu" id="firstnameu" value="<?php echo $content_data->name;?>" size="60"/><?php echo form_error('firstnameu')?></td>
            </tr>
            <tr>
                <td><label for="lastname">Last name :</label></td>
                <td><input type="text" name="lastname" value="<?php echo $content_data->prename;?>" id="lastnameu" size="60"/><?php echo form_error('lastname')?></td>
            </tr>
            <tr>
                <td><label for="birthday">Birthday :</label></td>
                <td>
                    D : <?php echo form_dropdown('birth_day',$day_data,get_date_part($content_data->birthday,'day'),'id="date"');?>
                    M : <?php echo form_dropdown('birth_month',$dropdown_data,get_date_part($content_data->birthday,'month'),'id="month"');?>
                    Y : <?php echo form_dropdown('birth_year',$year_data,get_date_part($content_data->birthday,'year'),'id="year1"');?>
                </td>
            </tr>
             <tr>
                <td><label for="death">Death :</label></td>
                <td>
                    D : <?php echo form_dropdown('leave_day',$day_data,get_date_part($content_data->death,'day'),'id="date"');?>
                    M : <?php echo form_dropdown('leave_month',$dropdown_data,get_date_part($content_data->death,'month'),'id="month"');?>
                    Y : <?php echo form_dropdown('leave_year',$year_data,get_date_part($content_data->death,'year'),'id="year1"');?>
                </td>
            </tr>
            <tr>
                <td><label for="address">Address : </label></td>
                <td><input type="text" name="address" id="address" class="medium" value="<?php echo $content_data->address;?>"/><?php echo form_error('address')?></td>
            </tr>
             <tr>
                <td><label for="description">Description : </label></td>
                <td>
                     <div>
                        <?php                                                                 
                            $data = array(
                            'name' => 'txtDes',
                            'id' => 'txtDes',
                            'width' => '600',
                            'height' => '400',
                            'value' =>generate_pure_text($content_data->description,'<p>','</p>')
                            );
                            echo form_fckeditor($data);
                        ?>
                    
                    </div>
                    <?php echo form_error('txtDes')?>
                </td>
            </tr>
             <tr>
                <td><input type="submit" class="submit" name="submit" value="Modifier" /></td>
            </tr>
        </table>
        </form>
    </div>
</div>